package com.jctrip.hotel.source.model.greentree.req;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlText;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**
 * @Author：Haruhi
 * @description:
 * @Date：2023/8/31 16:49
 * @Package：com.jctrip.hotel.source.model.greentree.req
 * @Project：hotel-main
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@JacksonXmlRootElement(localName = "CreateBooking")
public class CreateBookingActivityReq extends GreenTreeBaseReq{

    @JacksonXmlProperty(localName = "systemType",isAttribute = true)
    private String systemType;

    @JacksonXmlProperty(localName = "ReservationInfo")
    private ReservationInfo reservationInfo;

    @JacksonXmlProperty(localName = "CustomInfos")
    private CustomInfos customInfos;

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Builder
    public static class ReservationInfo {
        @JacksonXmlProperty(localName = "KeepTime")
        private String keepTime;

        @JacksonXmlProperty(localName = "StartDate")
        private String startDate;

        @JacksonXmlProperty(localName = "EndDate")
        private String endDate;

        @JacksonXmlProperty(localName = "HotelCode")
        private String hotelCode;

        @JacksonXmlProperty(localName = "AgentAgreementNo")
        private String agentAgreementNo;

        @JacksonXmlProperty(localName = "ReqRooms")
        private ReqRooms reqRooms;

        @JacksonXmlProperty(localName = "Guarantee")
        private Guarantee guarantee;

        /**
         * |费用总计：94|，为固定写法，集团接口会根据备注中的费用总计的价格与中央价格进行校验。
         */
        @ApiModelProperty(value = "|费用总计：xx|，为固定写法")
        @JacksonXmlProperty(localName = "Comment")
        private String comment;

        @JacksonXmlProperty(localName = "AgentUniqueID")
        private String agentUniqueID;

        @JacksonXmlProperty(localName = "ActivityCode")
        private String activityCode;

        @Data
        @NoArgsConstructor
        @AllArgsConstructor
        @Builder
        public static class ReqRooms {
            @JacksonXmlProperty(localName = "ReqRoom")
            private ReqRoom reqRoom;

            @Data
            @NoArgsConstructor
            @AllArgsConstructor
            @Builder
            public static class ReqRoom {
                @JacksonXmlProperty(localName = "roomTypeCode",isAttribute = true)
                private String roomTypeCode;

                @JacksonXmlProperty(localName = "RoomCount")
                private Integer roomCount;

                @JacksonXmlProperty(localName = "RoomRate")
                private RoomRate roomRate;

                @Data
                @NoArgsConstructor
                @AllArgsConstructor
                @Builder
                public static class RoomRate {
                    @ApiModelProperty(value = "RoomRate_默认CNY")
                    @JacksonXmlProperty(localName = "currencyCode",isAttribute = true)
                    private String currencyCode;

                    @JacksonXmlText
                    private BigDecimal price;
                }
            }
        }

        @Data
        @NoArgsConstructor
        @AllArgsConstructor
        @Builder
        public static class Guarantee {
            @JacksonXmlProperty(localName = "guaranteeType",isAttribute = true)
            private String guaranteeType;
        }
    }

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Builder
    public static class CustomInfos {
        @JacksonXmlProperty(localName = "CustomInfo")
        private CustomInfo customInfo;

        @Data
        @NoArgsConstructor
        @AllArgsConstructor
        @Builder
        public static class CustomInfo {
            @JacksonXmlProperty(localName = "FirstName")
            private String firstName;

            @JacksonXmlProperty(localName = "LastName")
            private String lastName;

            @JacksonXmlProperty(localName = "Gender")
            private String gender;

            @JacksonXmlProperty(localName = "NameTitle")
            private String nameTitle;

            @JacksonXmlProperty(localName = "ContactEmail")
            private String contactEmail;

            @JacksonXmlProperty(localName = "ContactPhone")
            private String contactPhone;
        }
    }
}
